﻿Namespace Activities
    Public Class ToDoProvider
        Private Shared mProvider As IToDoProvider

        Private Sub New()
        End Sub

        Public Shared Sub RegisterProvider(ByVal provider As IToDoProvider)
            mProvider = provider
        End Sub

        Public Shared Sub Show()
            mProvider.Show()
        End Sub
        Public Shared Sub OnActivityUpdated(ByVal activity As ActivityBase)
            mProvider.OnActivityUpdated(activity)
        End Sub
        Public Shared Sub EnsureVisible(ByVal activity As ActivityBase)
            mProvider.EnsureVisible(activity)
        End Sub
        Public Shared Sub AddRange(ByVal activities As Generic.List(Of ActivityBase))
            mProvider.AddRange(activities)
        End Sub
        Public Shared Sub Add(ByVal activity As ActivityBase)
            mProvider.Add(activity)
        End Sub

    End Class

    Public Interface IToDoProvider
        Sub Add(ByVal activity As ActivityBase)
        Sub AddRange(ByVal activities As Generic.List(Of ActivityBase))
        Sub OnActivityUpdated(ByVal activity As ActivityBase)
        Sub Show()
        Sub EnsureVisible(ByVal activity As ActivityBase)
    End Interface

    Public MustInherit Class ActivityBase
        MustOverride ReadOnly Property Timestamp() As Date
        MustOverride ReadOnly Property Type() As String
        MustOverride ReadOnly Property Information() As String
        MustOverride ReadOnly Property Id() As String
        MustOverride ReadOnly Property Closed() As Boolean
        MustOverride ReadOnly Property Image() As System.Drawing.Image
        MustOverride ReadOnly Property ImageKey() As String

        MustOverride Sub ShowHandleUI(ByVal owner As System.Windows.Forms.Form)

        Public Shared Sub OnActivityUpdated(ByVal activity As ActivityBase)
            ToDoProvider.OnActivityUpdated(activity)
        End Sub
    End Class
End Namespace